package com.tiamo.traders.controller;

import com.tiamo.traders.entity.LeaveWord;
import com.tiamo.traders.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/leave")
public class LeaveController {
    @Autowired
    LeaveService leaveService;

    @RequestMapping("/findAll")
    public List<LeaveWord> findAll() {
        return leaveService.findAll();
    }

    @RequestMapping("/leaveAdd")
    public Integer leaveAdd(LeaveWord leave) {
        return leaveService.leaveAdd(leave);
    }

    @RequestMapping("/leaveDelete")
    public Integer leaveDelete(LeaveWord leave) {
        return leaveService.leaveDelete(leave);
    }
    /*
    * 修改已发送状态
    * */
    @RequestMapping("/leaveUpdate")
    public Integer leaveUpdate(LeaveWord leave) {
        leave.setIsReply(1);
        return leaveService.leaveUpdate(leave);
    }
    @RequestMapping("/findById")
    public LeaveWord findById(LeaveWord leaveWord){
        return leaveService.findById(leaveWord);
    }
}
